Day 10 - Sorting and reducing

35

1 elephant

1 gorilla

[...]

As you can see results are ordered and reduced, but uniq also counts them before removing

duplicates, so we know that there are 3 lines containing cat and 2 lines containing dog, while

basilisk appears only once in the file. The result of uniq -c can be sorted again to get the results

that appear the most or the least, you will have to find a way in the first exercise of this chapter.

Exercise 10.01

Print the 5 more frequent IP addresses in the file simple.log

Go to solution

Exercise 10.02

Print the HTTP methods used by the requests in the file simple.log and count how many occurrences

are there for each one.

Go to solution

Now, this is what I think you should know about sorting and removing duplicates. Time to relax!

What about some pizza? After all I was wrong before, we probably love pizza much more than

sorting! Cowabunga!

Suggested film for the evening: Honey, I Shrunk the Kids (1989) - A scientist gets reducing a bit

wrong and his kids have to sort it out.